<template>
	<view>
		<simple-toolbar title="矿池-新建提币报表">
			<view>
				<el-button @click="navBack">返回</el-button>
				<el-button @click="confirm" type="primary" :disabled="success">确认</el-button>
			</view>
		</simple-toolbar>

		<view class="pad-base">
			<el-form :model="formData" :rules="rules" ref="formData" label-position="top">
				<el-form-item label="用户名" prop="id">
					<el-input v-model="formData.id" placeholder="请输入用户名"></el-input>
				</el-form-item>
				<el-form-item label="数量" prop="amount">
					<el-input v-model="formData.amount" placeholder="请输入数量"></el-input>
				</el-form-item>
				<el-form-item label="钱包地址" prop="wallet">
					<el-input v-model="formData.wallet" placeholder="请输入钱包地址"></el-input>
				</el-form-item>
				<el-form-item label="申请号" prop="transaction_id">
					<el-input v-model="formData.transaction_id" placeholder="请输入申请号"></el-input>
				</el-form-item>
				<el-form-item label="是否自动" prop="is_auto">
					<el-radio v-model="formData.is_auto" :label="true">是</el-radio>
					<el-radio v-model="formData.is_auto" :label="false">否</el-radio>
				</el-form-item>
				<!-- <el-form-item label="状态" prop="status">
					<el-select v-model="formData.status" placeholder="请选择">
						<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
						</el-option>
					</el-select>
				</el-form-item> -->
			</el-form>
		</view>
	</view>
</template>

<script>
	import {
		drawMoney
	} from "../../../js_sdk/uni-admin/assetPool.js"

	export default {
		data() {
			return {
				success: false,
				options: [{
						value: 'cancelled',
						label: 'cancelled'
					},
					{
						value: 'completed',
						label: 'completed'
					},
					{
						value: 'rejected',
						label: 'rejected'
					},
					{
						value: 'Rejected',
						label: 'Rejected'
					}
				],
				formData: {
					is_auto: true
				},
				rules: {
					id: [{
						required: true,
						message: '请输入用户名',
						trigger: 'blur'
					}],
					amount: [{
						required: true,
						message: '请输入数量',
						trigger: 'blur'
					}],
					wallet: [{
						required: true,
						message: '请输入钱包地址',
						trigger: 'blur'
					}],
					transaction_id: [{
						required: true,
						message: '请输入申请号',
						trigger: 'blur'
					}],
				}
			}
		},
		methods: {
			confirm() {
				this.$refs.formData.validate(async valid => {
					if (!valid) return
					await drawMoney('post', this.formData)
					this.success = true
					setTimeout(() => {
						uni.navigateBack()
					}, 1000)
				});
			},
			navBack() {
				uni.navigateBack()
			}
		},
	}
</script>

<style>

</style>
